<include file="Public:header" />
	<div class="container">
		<div class="page-header">
			<h4>{:L('SYSTEM_SETTINGS')}</h4>
		</div>
		<include file="Public:alert" />
		<div class="tabbable">
			<ul class="nav nav-tabs">
				<li><a href="{:U('setting/defaultInfo')}">{:L('SYSTEM_BASIC_SETTINGS')}</a></li>
				<li><a href="{:U('setting/smtp')}">{:L('SMTP_SETTINGS')}</a></li>
				<li class="active"><a href="{:U('setting/fields')}">{:L('CUSTOM_FIELDS')}</a></li>		
				<li><a href="{:U('navigation/setting')}">{:L('SYSTEM_MENU_SETTINGS')}</a></li>
				<li><a href="{:U('setting/weixin')}">{:L('MICRO_LETTER_PUBLIC_ACCOUNT_SETTINGS')}</a></li>
			</ul>
		</div>
		<div class="row">	
			<div class="span2 knowledgecate">
				<ul class="nav nav-list">
					<li class="active">
						<a href="javascript:void(0);" onclick="color_box()">{:L('CUSTOM_FIELDS')}</a>
					</li>
					<li><a href="{:U('setting/fields', 'model=customer')}"><i class="icon-chevron-right"></i>{:L('CUSTOMER_FIELDS_SETTINGS')}</a></li>
					<li><a href="{:U('setting/fields', 'model=business')}"><i class="icon-chevron-right"></i>{:L('BUSINESS_FIELDS_SETTINGS')}</a></li>
					<li><a href="{:U('setting/fields', 'model=product')}"><i class="icon-chevron-right"></i>{:L('PRODUCT_FIELDS_SETTINGS')}</a></li>
					<li><a href="{:U('setting/fields', 'model=leads')}"><i class="icon-chevron-right"></i>{:L('CLUES_FIELDS_SETTINGS')}</a></li>
					<li><a href="{:U('knowledge/category')}" class="active"><i class="icon-chevron-right"></i>{:L('KNOWLEDGE_CATEGORY')}</a></li>
				</ul>
			</div>
			<form action="{:U('knowledge/categoryDelete')}" method="post">
				<div class="span10">
					<p><div class="bulk-actions align-left">
						<button type="submit" class="btn" ><i class="icon-remove"></i>&nbsp;{:L('DELETE')}</button>
						<div class="pull-right">
							<a class="btn btn-primary" id="add_category" href="javascript:void(0);">{:L('ADD_KNOWLEDGE_CATEGORY')}</a>
						</div>
					</div></p>
				</div>
				<div class="span10">
					<table class="table table-hover table-striped table_thead_fixed" width="95%" border="0" cellspacing="1" cellpadding="0">
						<thead>
							<tr>
								<th width="15%"><input class="check_all" name="check_all" id="check_all" type="checkbox" /> &nbsp;</th>
								<th width="15%">{:L('CATEGORY_NAME')}</th>
								<th width="10%">{:L('ARTICLE_NUM')}</th>
								<th width="35%">{:L('CATEGORY_DESCRIPTION')}</th>
								<th width="15%">{:L('OPERATING')}</th>
							</tr>
						</thead>
						<tfoot>
							<tr>
								<td colspan="5">
									{$page}
								</td>
							</tr>
						</tfoot>
						<tbody>
							<volist name="category_list" id="vo">
								<tr>
									<td>
									<input class="list" type="checkbox" id="category" name="category_list[]" value="{$vo.category_id}"/> &nbsp;
									</td>
									<td>{$vo.name}</td>
									<td>{$vo.count}</td>
									<td>
										{$vo.description}
									</td>
									<td><a class="edit_category" rel="{$vo.category_id}" href="javascript:void(0)">{:L('EDIT')}</a> &nbsp;
									<a href="{:U('knowledge/index','by=all&category_id='.$vo['category_id'])}">{:L('VIEW_THIS_CATEGORY')}</a></td>
								</tr>
							</volist>
						</tbody>
					</table>
				</div> <!-- End #main-content -->
			</form>
		</div>		
	</div>
	<div id="dialog-message1" class="hide" title="{:L('ADD_ARTICLE_CATEGORY')}">loading...</div>
	<div id="dialog-message2" class="hide" title="{:L('EDIT_CATEGORY_INFO')}">loading...</div>
<script type="text/javascript">
	function changeContent(){
		a = $("#select1  option:selected").val();
		if(a=='1'){
			window.location.href="{:U('knowledge/index')}";
		}else if(a=='2'){
			window.location.href="{:U('knowledge/category')}";
		}else if(a=='3'){
			window.location.href="{:U('knowledge/count')}";
		}
	}

	$('#dialog-message1').dialog({
		autoOpen: false,
		modal: true,
		width: 600,
		maxHeight: 400,
		position :["center",100]
	});

	$('#dialog-message2').dialog({
		autoOpen: false,
		modal: true,
		width: 600,
		maxHeight: 400,
		position :["center",100]
	});

	$(function(){
		$("#check_all").click(function(){
			$("input[class='list']").prop('checked', $(this).prop("checked"));
		});
		$("#add_category").click(function(){
			$('#dialog-message1').dialog('open');
			$('#dialog-message1').load('{:U('knowledge/categoryAdd')}');
		});
		$(".edit_category").click(function(){
			$('#dialog-message2').dialog('open');
			$id = $(this).attr('rel');
			$('#dialog-message2').load("{:U('knowledge/categoryEdit','id=')}"+$id);
		});
	});
</script>
<include file="Public:footer" />